package AbstractTransactions

import (
	"SPC/Database"
	"SPC/Model"
)

type ChangeEmployeeTransaction struct {
	itsEmpid int
	Change   func(e Model.Employee)
}

func NewChangeEmployeeTransaction(empid int) *ChangeEmployeeTransaction {
	return &ChangeEmployeeTransaction{
		itsEmpid: empid,
	}
}

func (c *ChangeEmployeeTransaction) Execute() {
	e := Database.GetPayrollDatabase().GetEmployee(c.itsEmpid)
	if(e.GetEmpid() != 0){
		c.Change(e)
	}
}
